
<!--
All rights Reserved, Designed By www.youyacao.com
@Description:附件配置
@author:成都市一颗优雅草科技有限公司
@version V4.2
注意：本前端源码遵循 MIT开源协议本内容仅限于个人参考，禁止用于其他的商业用途
需要商业用途或者定制开发等可访问songshu.youyacao.com   联系QQ:422108995 23625059584
开源gitee地址：https://gitee.com/youyacao/songshu-video-page
 -->


<template>
  <div>
    <div class="crumbs">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item>
          <i class="el-icon-lx-calendar"></i> 站点配置
        </el-breadcrumb-item>
        <el-breadcrumb-item>附件配置</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="container">
      <div class="form-box">
        <el-form ref="form" :model="form" label-width="230px">
          <el-form-item label="允许上传文件大小(MB)">
            <el-input v-model="form.ext_max_size"></el-input>
          </el-form-item>
          <el-form-item label="允许上传文件类型(英文逗号分隔)">
            <el-input v-model="form.ext_type"></el-input>
          </el-form-item>
          <el-form-item label="是否开启视频水印">
            <el-input v-model="form.ext_isopen_watermark"></el-input>
          </el-form-item>
          <el-form-item label="水印图片地址">
            <el-input v-model="form.sms_watermark_url"></el-input>
          </el-form-item>
          <el-form-item label="水印位置">
            <el-radio-group v-model="form.sms_watermark_position">
              <el-radio label="随机位置"></el-radio>
              <el-radio label="顶部居左"></el-radio>
              <el-radio label="中部居左"></el-radio>
              <el-radio label="底部居左"></el-radio>
              <el-radio label="顶部居右"></el-radio>
              <el-radio label="中部居右"></el-radio>
              <el-radio label="底部居右"></el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">提交</el-button>
            <el-button>取消</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
import qs from "Qs";
export default {
  name: "baseform",
  data() {
    return {
      form: {}
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      this.$api.config.get({}).then(res => {
        this.form = res.data;
      });
    },
    onSubmit() {
      var data = [];
      for (let item in this.form) {
        data[`config[${item}]`] = this.form[item];
      }
      console.log(data);
      this.$api.config.set(qs.stringify(data)).then(res => {
        console.log(res.data);
      });
      this.$message.success("提交成功！");
    }
  }
};
</script>